import Qt 4.7

Rectangle {
    id: container

    width: 525; height: 314
    color: "transparent"

    signal callUpdateGoals
    signal callMessageBox(string mesgBox, string nextView)

    function initialize() {
        targetsList.visible = false;
        addTargetView.visible = false;

        targetsList.visible = true;
        addTargetView.visible = false;
    }
    function updateGoals(m_model) {
        targetsList.model = m_model;
    }

    Text {
        id: targetLabel

        x: 39; y: 17
        text: "Metas"; color: "#00adef"
        font { pointSize: 12; weight: Font.DemiBold; family: "Series 60 Sans" }
    }
    TargetsList {
        id: targetsList

        x: 0; y: 110
        width: 525; height: 204

        onCallAddView: {
            targetsList.visible = false;
            addTargetView.visible = true;
            addTargetView.mode = "Add";
        }

        onCallEditView: {
            addTargetView.enableEditMode(index);

            targetsList.visible = false;
            addTargetView.visible = true;
        }
    }
    AddTargetView {
        id: addTargetView

        x: 0; y: 80
        width: 525; height: 204
        visible: false

        onCallMessageBox: {
            container.callMessageBox(mesgBox, nextView);
            container.callUpdateGoals();
        }
    }
}
